import numpy as np
from scipy.fftpack import fft, ifft
import matplotlib.pyplot as plt

Fs = 2000  # 采样频率
T = 1 / Fs  # 周期
L = 3000  # 信号长度
t = np.arange(L) * T

# 构造一个信号函数：s = 1.5×sin(2π×70×t)+2×sin(2π×120×t)
s = 1.5 * np.sin(2 * np.pi * 70 * t) + 2 * np.sin(2 * np.pi * 150 * t)
x = s + np.random.randn(L)

plt.plot(t[:50], x[:50])
plt.xlabel('Time(s)')
plt.ylabel('Amplitude')
plt.title('Signal with random noise')
plt.show()